package cn.cqk.v6.builder;

import cn.cqk.v6.enums.Event;
import cn.cqk.v6.enums.State;
import cn.cqk.v6.handle.SopProcess;
import cn.cqk.v6.iface.IStateHandle;

public class SopProcessBuilder {

    private SopProcess sopProcess;

    public void setSopProcess(SopProcess sopProcess) {
        this.sopProcess = sopProcess;
    }

    public static SopProcessBuilder getInstance() {
        SopProcessBuilder sopBuilder = new SopProcessBuilder();
        sopBuilder.setSopProcess(new SopProcess());
        return sopBuilder;
    }

    public SopProcessBuilder from(State state) {
        sopProcess.setFrom(state);
        return this;
    }

    public SopProcessBuilder handle(IStateHandle stateHandle) {
        sopProcess.setStateHandle(stateHandle);
        return this;
    }

    public SopProcessBuilder to(State state) {
        sopProcess.setTo(state);
        return this;
    }

    public SopProcessBuilder event(Event state) {
        sopProcess.setEvent(state);
        return this;
    }

    public SopProcess build() {
        return sopProcess;
    }
}